Alternate create link

I've been thinking about creating a custom create links where a dialog is displayed and a few link attributes have to filled in before the link is allowed to be created.

I have not been able to figure out a way to add this to the standard create link functionality, so I thought I would just create a new function. However, I have not been able to figure out how to capture the pink link start objects in the "other" module. Anyone have any tips on how to solve this?

/Kristian
SystemAdmin - Wed Nov 25 04:20:33 EST 2009

Re: Alternate create link
Mathias Mamsch - Thu Nov 26 04:05:21 EST 2009

I am pretty sure there is no way to really "hook" link creation, since this function is built in the module editor and is not controllable by dxl. I am also not aware of any way to determine link start and link end. This makes creating a custom link dialog quite hard.

However you can could disable/replace the standard link creation menu and use a drag/drop trigger to prevent the user from creating links by drag and drop. This might be the only way to force the user to use your new link function.
For this you would replace the menu items for link creation with your own:
 

  • go to your lib/dxl/config/formal.dxl file and replace the
createMenu(alwaysOn,"Link", 'L', null  )
    
    createItem linkStartItem
    createItem linkClearStartItem
 
    createItem linkCompleteFromItem
    createItem linkCompleteToItem

 


by your own code:

 

 

createItem (linkStartItem, "Make Link New", 'L','L',null,null,null,null, "C:\\TEST.dxl")


where test.dxl has your new code

But this still leaves problems, since you would have to implement a new "Start Link" and "Make link from start" mechanism, where you would have to cope with global variables and stuff, so it is really not that simple. You could also use triggers to check if the user created links (look at the history) in the current session, check the links and prompt him to fill out the attributes.

Regards, Mathias

 

Re: Alternate create link
SystemAdmin - Thu Nov 26 08:03:34 EST 2009

Mathias Mamsch - Thu Nov 26 04:05:21 EST 2009

I am pretty sure there is no way to really "hook" link creation, since this function is built in the module editor and is not controllable by dxl. I am also not aware of any way to determine link start and link end. This makes creating a custom link dialog quite hard.

However you can could disable/replace the standard link creation menu and use a drag/drop trigger to prevent the user from creating links by drag and drop. This might be the only way to force the user to use your new link function.
For this you would replace the menu items for link creation with your own:
 

  • go to your lib/dxl/config/formal.dxl file and replace the
createMenu(alwaysOn,"Link", 'L', null  )
    
    createItem linkStartItem
    createItem linkClearStartItem
 
    createItem linkCompleteFromItem
    createItem linkCompleteToItem

 


by your own code:

 

 

createItem (linkStartItem, "Make Link New", 'L','L',null,null,null,null, "C:\\TEST.dxl")


where test.dxl has your new code

But this still leaves problems, since you would have to implement a new "Start Link" and "Make link from start" mechanism, where you would have to cope with global variables and stuff, so it is really not that simple. You could also use triggers to check if the user created links (look at the history) in the current session, check the links and prompt him to fill out the attributes.

Regards, Mathias

 

Yes, there seems to be a problem to hook the link creation. Removing the standard drag-and-drop seems a bit brutal, as it is only one or two modules that this is needed for...

Another interesting question is how to catch a newly created link.

Object source -> [string linkModuleName ->] Object target

does not return a link, but one is created. It does not seem elegant to loop over all links from "source object" and check if it goes to "target object", but that's the only idea I have.

/Kristian

Re: Alternate create link
SystemAdmin - Thu Nov 26 10:18:15 EST 2009

SystemAdmin - Thu Nov 26 08:03:34 EST 2009

Yes, there seems to be a problem to hook the link creation. Removing the standard drag-and-drop seems a bit brutal, as it is only one or two modules that this is needed for...

Another interesting question is how to catch a newly created link.

Object source -> [string linkModuleName ->] Object target

does not return a link, but one is created. It does not seem elegant to loop over all links from "source object" and check if it goes to "target object", but that's the only idea I have.

/Kristian

Link l = Object source -> Object target does work returning handle to the new link.

Cheers, Pekka

Re: Alternate create link
Mathias Mamsch - Thu Nov 26 16:37:31 EST 2009

SystemAdmin - Thu Nov 26 10:18:15 EST 2009
Link l = Object source -> Object target does work returning handle to the new link.

Cheers, Pekka

Ideed the ::->() operator returns a link. The relevant perms are:
 

Link ::-> (Object, Object)
Link ::-> (Object, Object)
Link ::-> (OutLinkRef__, Object)
Link ::-> (OutLinkRef__, Object)
OutLinkRef__ ::-> (Object, string)
OutLinkRef__ ::-> (Object, string)

 


Regards, Mathias